package cn.yzy.commonUtil;

import java.awt.Component;

import javax.swing.JFrame;
import javax.swing.JPanel;

public class MyUITools {
	
	/**
	 * 
	 * @param comp
	 * @return
	 * done
	 */
	public static JPanel getFirstJPanel(Component comp) {
		Component currentComp=comp;
		while(!(currentComp.getParent() instanceof JPanel)){
			currentComp=currentComp.getParent();
		}
		return (JPanel)currentComp.getParent();
	}
	
	
	public static JFrame getFirstJFrame(Component comp) {
		Component currentComp=comp;
		while (!(currentComp.getParent() instanceof JFrame)) {
			currentComp=currentComp.getParent();
		}
		return (JFrame)currentComp.getParent();
	}

}
